package com.atguigu.myrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

// 替换掉Ribbon的默认负载均衡机制，这个类所在的包要放在主启动类扫描范围之外，并且在主启动类上标注
// @RibbonClient(name = "CLOUD-PAYMENT-SERVICE",configuration = {MySelfLoadBalanceRule.class})
// 才能生效
@Configuration
public class MySelfLoadBalanceRule {

    @Bean
    public IRule iRule(){
        return new RandomRule();
    }
}
